﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class Clients_payonline : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            panel_Platba.Visible = true;
            panel_Potvrzeni.Visible = false;
        }
    }
    protected void cmd_Vymazat_Click(object sender, EventArgs e)
    {
        txt_Prijemce.Text = txt_Castka.Text = txt_Komentar.Text = "";
    }
    protected void cmd_NovaPlatba_Click(object sender, EventArgs e)
    {
        cmd_Vymazat_Click(sender, e);
        panel_Platba.Visible = true;
        panel_Potvrzeni.Visible = false;
    }
    protected void cmd_Odeslat_Click(object sender, EventArgs e)
    {
        //Payment p = DatabaseManager.saveOnlinePayment(Context.User.Identity.Name, txt_Prijemce.Text, Convert.ToInt32(txt_Castka.Text), rdb_Ne.Checked, txt_Datum.Text, txt_Komentar.Text);

        bool OK = PaymentManager.payOnline(Context.User.Identity.Name, txt_Prijemce.Text, txt_Castka.Text, txt_Komentar.Text);

        if (OK == true)
        {
            lbl_VysledekRegistrace.Text = "Platba probehla uspešne";
            lbl_VysledekRegistrace.ForeColor = System.Drawing.Color.Green;
        }
        else
        {
            lbl_VysledekRegistrace.Text = "platba se nezdařila";
            lbl_VysledekRegistrace.ForeColor = System.Drawing.Color.Red;
        }

        lbl_PopisPlatby.Text = "popis platby...";
        panel_Platba.Visible = false;
        panel_Potvrzeni.Visible = true;
    }
}
